#include "../app/app_mqtt.h"
#include "../thirdparty/log.h"
#include <stdlib.h>
#include <unistd.h>

int mqtt_callback(char *data ,int len)
{
	log_info(" receive data: %.*s\r\n",len,data);
	return 0;
}
int main(int argc, char const *argv[])
{
    // 1    初始化mqtt
    int ret = app_mqtt_init();
    if (ret < 0)
    {
        log_error("app_mqtt_init failed\r\n");
    }
    // 2    注册回调
    app_mqtt_register_recv(mqtt_callback);
    // 3    发送数据
	app_mqtt_send("hello world",11);
    // 等待
    sleep(10000);
    // 4    销毁mqtt客户端
    app_mqtt_destroy();
    
    return 0;
}